package com.example.demo.enums;

import lombok.Data;


public enum BookStatus {
    Invalid(0,"无效"),
    Available(1,"可借阅"),
    Prohibited(2,"不可借阅");
    private Integer code;
    private String dsc;
    BookStatus(Integer code, String dsc) {
        this.code = code;
        this.dsc = dsc;
    }

    public String getDsc() {
        return dsc;
    }

    public void setDsc(String dsc) {
        this.dsc = dsc;
    }

    public static BookStatus getStatus(Integer code){
        switch (code){
            case 0:return BookStatus.Invalid;
            case 1:return BookStatus.Available;
            case 2:return BookStatus.Prohibited;
            default:return null;
        }
    }
}
